figure.Valvula = new Class({
    Extends: figure.DomFigure,

    initialize: function(id, css) {
        this.parent(id);
        this.createElement('canvas', {
            id: id,
            Width: 50,
            Height: 50,
            css: css
        });
        this.element = this.getElement();
        css.top = css.top - 26;
        css.left = css.left + 6;
        this.alarm = new figure.Alarm(id + 'Alarm', css);
    },

    draw: function(color) {
        var context = this.element[0].getContext('2d');
        context.beginPath();
        context.moveTo(0, 0);
        context.lineTo(20, 20);
        context.lineTo(0, 20);
        context.lineTo(20, 0);
        context.closePath();
        context.fillStyle = color;
        context.fill();
        context.stroke();
        this.alarm.draw();
        if (color == 'green') {
            for (i = 0; i< this.indicators.length; i++){
                this.indicators[i].on();
            }
        }
        if (color == 'yellow') {
            for (i = 0; i< this.indicators.length; i++){
                this.indicators[i].off();
            }
        }
    }

});